package com.xuanwu.shop.service.impl;

import com.xuanwu.shop.dao.CustomerDaoInterface;
import com.xuanwu.shop.dao.impl.CustomerDaoImpl;
import com.xuanwu.shop.entity.Customer;
import com.xuanwu.shop.service.CustomerServiceInterface;

public class CustomerServiceImp implements CustomerServiceInterface {
	CustomerDaoInterface customerDao = new CustomerDaoImpl();
	@Override
	public Customer login(String uname, String passwd) {
		
		Customer customer = customerDao.findByName(uname);
		if(customer != null && customer.getPasswd().trim().equals(passwd)){
			return customer;
		}
		return null;
	}

	@Override
	public boolean register(Customer customer) {
		return customerDao.save(customer);
	}

	@Override
	public Customer getById(String id) {
		return customerDao.findById(id);
	}

}
